package com.wlcj.enumtype;

public enum TimeUnitEnum {
	
	DAY(1, "天"),
	MONTH(2, "月"),
	YEAR(3, "年");
	
	private int code;
	private String desc;
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	private TimeUnitEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	public static TimeUnitEnum getEnumByCode(int code) {
		for(TimeUnitEnum enumtype:values()) {
			if(code==enumtype.getCode())
				return enumtype;
		}
		return null;
	}

}
